Currently, with the development of communications technologies, Wireless Fidelity (WiFi) functions become increasingly popular. WiFi peer to peer (P2P) may also be referred to as WiFi direct, and is a discovery and connection protocol that belongs to social WiFi. With the use of a WiFi P2P technology, direct end-to-end discovery between friends or adjacent services can still be implemented by using a WiFi function in the absence of an infrastructure (a cellular network and a hotspot). In other words, WiFi P2P requires neither a real-time connection to a server, nor a communications infrastructure in any form; instead, a user directly implements end-to-end discovery and information interaction.
With the use of the WiFi P2P technology, discovery and connection between devices mainly include the following steps: a scanning and discovery process; a group owner (GO) negotiation process after discovery; a WiFi protected setup (WPS) authentication process; and association (a four-way handshake) and communication.
Devices scan for and discover each other by using WiFi. After the discovery, a wireless device group needs to be established for the devices. To establish the wireless device group, one device needs to act as a GO, so that a GO negotiation process is required. After the group owner is determined through negotiation, the group owner authenticates a device. After the authentication succeeds, the GO issues one credential to the device, so that the device joins the wireless device group and becomes a group member of the wireless device group. A process of issuing a credential is a process of WPS authentication.
Based on WiFi P2P, after the wireless device group is established for the devices, if a user wants to connect a new device of the user to the wireless device group, the user needs to first enable the new device to scan for and discover the GO by using WiFi, and then executes a process of WPS authentication with the GO. After the authentication is completed, the new device joins the wireless device group. However, in an established wireless device group, in addition to a GO, there are many devices that have been associated with the GO. To join the wireless device group, the new device needs to scan for and discover the GO, and then executes a process of WPS authentication. During scanning and discovery, the user needs to confirm which device is the GO and often needs to approach the GO to perform an operation. However, in many cases, the GO is unreachable by the user (for example, it is inconvenient for the user to approach the GO), or the user has no idea which specific device is the GO, so the user needs to make multiple attempts. Therefore, in the prior art, when a user connects a new device to an established wireless device group, an operating procedure is complex, and efficiency is low.